package com.note.chh.notebook.Adapter;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.note.chh.notebook.Model.RankListModel;
import com.note.chh.notebook.R;

/**
 * Created by caihuahui on 2018/3/28.
 */

public class RankListAdapter extends BaseQuickAdapter<RankListModel.SongsBean.ListBean,BaseViewHolder>{
    public RankListAdapter(int layoutResId) {
        super(layoutResId);
    }

    private String[] split = null;
    @Override
    protected void convert(BaseViewHolder helper, RankListModel.SongsBean.ListBean item) {
        if (!item.getFilename().isEmpty()) {
            split = item.getFilename().split("-");
        }
        helper.setText(R.id.mText_number,helper.getPosition()<10?"0"+(helper.getPosition()):String.valueOf(helper.getPosition()))
                .setText(R.id.mText_songName,split!=null&&split.length>1?split[1]:item.getRemark())
                .setText(R.id.mText_singer,split!=null&&split.length>0?split[0]:"");

    }
}
